/**
***************************************************
*@file  timer.h
*@brief timer.h
*@author 花满楼
*@date     2020-7-1 
*@version  V1
*@note 定时器相关的定义
***************************************************
*/
#ifndef _TIMER_H
#define _TIMER_H
#include "sys.h"

#define  DEBUG_TEST 1	///<调试的编译与处理命令

#ifndef TIME_COUNT_YEAR
    #define TIME_COUNT_YEAR 0xBBF81E00  ///<以10ms为计数基准，计满1年
#endif
#ifndef TIME_COUNT_0P75S
    #define TIME_COUNT_0P75S 0x48   ///<以10ms为计数基准，计满0.75s
#endif
#ifndef TIME_COUNT_1S
    #define TIME_COUNT_1S 0x64  ///<以10ms为计数基准，计满1s
#endif
#ifndef TIME_COUNT_2S
    #define TIME_COUNT_2S 0xC8  ///<以10ms为计数基准，计满2s
#endif
#ifndef TIME_COUNT_5S
    #define TIME_COUNT_5S 0x1F4 ///<以10ms为计数基准，计满5s
#endif
#ifndef TIME_COUNT_1MIN
    #define TIME_COUNT_1MIN 0x1770  ///<以10ms为计数基准，计满1min
#endif
#ifndef TIME_COUNT_3HOUR
    #define TIME_COUNT_3HOUR 0x00107AC0 ///<以10ms为计数基准，计满3h
#endif

extern u32 timer_count;     ///<定时器计数值，范围0~0x‭BBF81E00‬,即可计数满1年
extern u8 timer_eep_1s;     ///<用于记录计满1s的标志位，做数据存储用
extern u8 timer_soc_1s;     ///<用于记录计满1s的标志位，做SOC的LED显示闪烁
extern u8 timer_alr_2s;     ///<用于故障LED告警时候的闪烁
extern u8 timer_run_1s;     ///<用于运行LED告警时候的闪烁
extern u8 timer_alr_0P75s;  ///<用于故障LED告警时候的闪烁 0.75s

extern TIM_HandleTypeDef TIM3_Handler;      ///<定时器句柄
extern u8 CAN1_TCount;
extern u16 CAN1_send_Count;

void TIM3_Init(u16 arr, u16 psc);
#endif

